package com.jqh.jetpackdemo;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;

import android.os.Bundle;

import com.jqh.jetpackdemo.databinding.ActivityMainBinding;

public class MainActivity extends AppCompatActivity {

    ActivityMainBinding dataBinding;
    private MyViewModelWithLiveData myViewModelWithLiveData;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);
        myViewModelWithLiveData = new ViewModelProvider(this).get(MyViewModelWithLiveData.class);
        dataBinding.setData(myViewModelWithLiveData);
        dataBinding.setLifecycleOwner(this);
    }
}
